package m.html.element.icon;

import m.html.element.Element;
import m.html.element.Text;

public abstract class AbstractIcon extends Element {
    protected abstract String iconName();
    protected abstract String iconPath();
    protected abstract String viewBox();
    public AbstractIcon(){this("svg");}
    protected AbstractIcon(String tagName) {
        super(tagName);
        this.setExtend("focusable=\"false\" aria-hidden=\"true\"");
        this.A("viewBox",viewBox());
        this.A("data-icon",iconName());
        this.A("width","14px");
        this.A("height","14px");
        this.A("fill","currentColor");
        this.E(new Text(iconPath()));
    }
    public AbstractIcon setSize(int size) {
        this.A("width",size+"px");
        this.A("height",size+"px");
        return this;
    }

    public AbstractIcon setColor(String color) {
        this.A("fill",color);
        return this;
    }
}
